import Request from '@/axios'
import {AxiosResponse} from "_axios@1.3.4@axios";

export class FileService {
    /**
     * @description 文件列表
     */
    static async list(params: any): Promise<AxiosResponse<IResultData<IPageList<IFileInfo>>>> {
        return Request.post('/file/list', params)
    }

    /**
     * @description 文件上传
     */
    static async upload(params: any, config?: object): Promise<AxiosResponse<IResultData<IFileInfo>>> {
        return Request.post('/file/upload', params, config)
    }

    /**
     * @description 文件下载
     */
    static async download(params: any): Promise<AxiosResponse<IResultData>> {
        return Request.get('/file/download', {responseType: 'blob', params})
    }

    /**
     * @description 文件删除
     */
    static async delete(params: any): Promise<AxiosResponse<IResultData>> {
        return Request.get('/file/delete', {params})
    }
}
